{% extends 'base.html' %}
{% load static %}
{% block title %}
    <title>登录日志</title>
{% endblock title %}
{% block css %}{% endblock %}


{% block navheader %}
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1>登录日志</h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="{% url 'assets:dashboard' %}">首页</a></li>
                        <li class="breadcrumb-item"><a href="#">用户管理</a></li>
                        <li class="breadcrumb-item active">登录日志</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>
{% endblock navheader %}


{% block content %}
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">登录日志</h3>
        </div>
        <!-- /.card-header -->
        <div class="card-body">
            <table id="assets-lists" class="table table-bordered table-striped">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>用户名,昵称</th>
                    <th>事件类型</th>
                    <th>事件详情</th>
                    <th>IP地址</th>
                    <th>用户代理</th>
                    <th>事件时间</th>
                </tr>
                </thead>
                <tbody>
				{% for event in events %}
                <tr
				{% if event.event_type == 3 or event.event_type == 4 %}
				style="color:red;"
				{% elif event.event_type == 1 or event.event_type == 5 %}
				style="color:green;"
				{% endif %}
				>
                  <td>{{ forloop.counter }}</td>
				  <td>{{ event.user }}</td>
				  <td>{{ event.get_event_type_display }}</td>
				  <td>{{ event.detail }}</td>
				  <td>{{ event.address }}</td>
				  <td>{{ event.useragent }}</td>
				  <td>{{ event.create_time|date:"Y/m/d H:m:s" }}</td>
                </tr>
				{% empty %}
                <tr>没有数据！</tr>
				{% endfor %}
                </tbody>
            </table>
        </div>
        <!-- /.card-body -->
    </div>


{% endblock %}

{% block js %}

{% endblock js %}